Reports for WPF allow users to load reports that contain custom fields by using the CustomFields assembly. Reports created by the C1ReportDesigner application offers following custom fields:
- Chart
- SuperLabel
- Gradient
- QRCode
- Map
Note that some custom fields, such as those listed below, need additional ComponentOne assemblies to be referenced:
- Chart: C1.Win.C1Chart
- SuperLabel: C1.Win.C1SuperTooltip
- QRCode: C1.Win, C1.Win.BarCode
- Map: C1.WPF.Maps
The following sample creates the report definition with Chart custom field, loads, and renders it to C1DocumentViewer in WPF application; the steps are illustrated as follows:
- Create the report definition:
- Open the C1ReportDesigner application. For more information on how to access the C1ReportDesigner, see Accessing C1ReportDesigner from Visual Studio.
- Create a new report by using C1Report Wizard. Set the Employees table in C1NWind.mdb as the data source, select the fields, and set the report name as "Chart".
- Click the Design button to begin editing the report.
- In the Custom Fields group of the Insert tab, click the Chart button.
- Place the Chart field in your report and resize the field to show the chart.
- From the Properties window, set the properties of the Chart field as following:
- DataX: Country
- DataY: EmployeeID
- Aggregate: Count
- ChartType: Column
- YMin: 0
- Preview the report by pressing F5.
- Save the report definition file with the file name "ChartField.xml". The design view of the report definition is as shown:

- Create the WPF application:
- Create a new WPF application. In order to access C1NWind.mdb, set the project's platform target to x86.
- Add following assemblies to the References in the project:
- C1.WPF.C1Report.CustomFields
- C1.WPF.C1Report
- C1.WPF
- C1.Win.C1Chart
- Add the report definition file ChartField.xml into the project folder. Set its 'Copy to Output Directory' property to 'Copy if newer'.
- Add C1DocumentViewer control into the MainWindow.
- In the code view, add the following code:
C# |
Copy Code
|
public MainWindow()
{
InitializeComponent();
var report = new C1.C1Report.C1Report();
report.Load("ChartField.xml", "Chart");
this.c1DocumentViewer.Document = report.C1Document.FixedDocumentSequence;
}
|
VB |
Copy Code
|
Public Sub New()
InitializeComponent()
Dim report = New C1.C1Report.C1Report()
report.Load("ChartField.xml", "Chart")
Me.c1DocumentViewer.Document = report.C1Document.FixedDocumentSequence
End Sub
|
- Run the application. You see the report with custom field rendered in the C1DocumentViewer as shown:

For more information on creating chart custom field, see the
Adding Chart Fields topic. The report definition CustomFields.xml available in the default location C:\Users\Windows 8.1\Documents\ComponentOne Samples\Studio for WPF\C1.WPF.C1Report\C1WPFReport\XML\CommonTasks\ contains all the custom fields.
From 2015v2 onwards, for WPF applications referencing C1.WPF.C1Report.CustomFields.4 dll, please add C1.Win.4 and C1.Win.Barcode.4 dlls to your projects.